<!-- 滚动 -->
<script setup lang="ts">
import { onMounted, onBeforeUnmount } from 'vue'
import utils from '@/utils/utils';


onMounted(() => {
    handleScroll();
})
function handleScroll() {
    window.addEventListener('scroll', (e) => {
        //目录跳转
        let directoryEl: any = document.querySelector(".directory-warp")
        if (directoryEl) {
            const jumbotronTop = utils.getStyle('#jumbotron', 'height')
            if (window.scrollY >= parseInt(jumbotronTop)) {
                utils.setStyle('.directory-warp', 'position', 'fixed')
            } else {
                utils.setStyle('.directory-warp', 'position', 'absolute')
            }
        }
    });
}
onBeforeUnmount(() => {
    window.removeEventListener('scroll', () => { }); // 离开当前组件移除事件监听
});
</script>
<template></template>